<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>



<script>
    /*普通函数*/
    function fn(){
        console.log("鲁大师")
        console.log(this)    //指向windows
    }

    fn()

    /*对象的方法*/
    var obj={
        sayHi:function (){
            console.log("asd")
        }
    }

    obj.sayHi();

    /*构造函数*/
    function Star(name){
        this.name=name;
    }

   var star= new Star('鲁大');
    console.log(star.name);


    /*绑定事件函数*/
   onclick=function (){
        console.log("123")
    }


    /*定时器函数*/
    setInterval(function (){
        console.log('456')
        console.log(this)     //指向windows
    },1000);


    /*立即执行函数*/
    (function (){
        console.log('我是立即执行函数')
        console.log(this)                  //指向windows
    })()


</script>
</body>
</html>